package cn.readjava.service.impl;

import cn.readjava.bean.UserRole;
import cn.readjava.dao.UserRoleDao;
import cn.readjava.service.UserRoleService;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@CacheConfig(cacheNames = "userRole")
public class UserRoleServiceImpl implements UserRoleService {

    @Resource
    private UserRoleDao userRoleDao;

    @Override
    @Cacheable(key = "'userRole ' + #p0")
    public List<UserRole> findAllByUId(long id) {
        return userRoleDao.findAllByUId(id);
    }
}
